function objGroup(obj1, obj2) {
  obj1.next = obj2;
  obj2.prev = obj1;
  return {
    o1: obj1,
    o2: obj2,
  };
}
const obj = objGroup({ name: 'obj1' }, { name: 'obj2' });
console.log(obj);
/* 
  {
    o1: {
      name: 'obj1',
      next: { name: 'obj2', prev: [Circular *1] }
    },
    o2: {
      name: 'obj2',
      prev: <ref *1> { name: 'obj1', next: [Circular *2] }
    }
  }
*/
